/*
 * @Author: taoyuqing
 * @Date: 2022-12-24 16:04:35
 * @Description: 抽屉选择按钮
 */
import 'dart:ffi';

import 'package:flutter/material.dart';
import 'package:spree/utils/utils.dart';

class DrawerSelectMenu extends StatefulWidget {
  final String? imgPath;
  final String name;
  bool? useIcon;
  Widget? child;
  DrawerSelectMenu(
      {Key? key, this.imgPath, required this.name, this.child, this.useIcon = true})
      : super(key: key);

  @override
  State<DrawerSelectMenu> createState() => _DrawerSelectMenuState();
}

class _DrawerSelectMenuState extends State<DrawerSelectMenu> {
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(left: 15, right: 15),
      decoration: BoxDecoration(
        color: Utils().createMaterialColor(),
        borderRadius: const BorderRadius.all(Radius.circular(8.0)),
      ),
      height: 44,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Container(
            child: Row(
              children: [
                widget.useIcon == true && widget.imgPath != null? Container(
                  width: 20,
                  height: 20,
                  margin: EdgeInsets.only(right: 10),
                  child: Image.asset(widget.imgPath??''),
                ):Container(),
                Text(
                  widget.name,
                  style: TextStyle(color: Color(0xFFB0AFEC)),
                )
              ],
            ),
          ),
          widget.child ?? Container()
        ],
      ),
    );
  }
}
